﻿using DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace WebIndex1.Class
{
    public class AuthorizeAdmin : AuthorizeAttribute
    {
        public IUnitOfRepositories Repositories { get; set; }
        
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            return httpContext.User.Identity.IsAuthenticated && Helper.GetUser(Repositories.UserRepo).IsAdmin ;

        }
    }
}